<!--
 * @Author: xia.duanjian
 * @Date: 2022-09-17 09:53:25
 * @LastEditors: xia.duanjian
 * @LastEditTime: 2022-09-18 19:52:42
 * @Description: file content
-->
<template>
  <div class="hello">
    <h1>{{ msg }}</h1>
    <p>
      For a guide and recipes on how to configure / customize this project,<br>
      check out the
      <a href="https://cli.vuejs.org" target="_blank" rel="noopener">vue-cli documentation</a>.
    </p>
    <h3>Installed CLI Plugins</h3>
    <ul v-for="item in lists" :key="item.id">
      <li>
        <p>姓名：{{item.cname}} 年龄：{{item.age}} 地址：{{item.countrysx}}</p>
        <p>邮箱：{{item.email}} 手机号：{{item.phone}}</p><br/>
        <img :src="item.img" alt="" width="100" height="100">
      </li>
    </ul>
  </div>
</template>

<script>
import $http from '@/api/http'
export default {
  name: 'HelloWorld',
  props: {
    msg: String
  },
  data () {
    return {
      lists: []
    }
  },
  created () {
    $http({
      methods: 'get',
      url: '/list',
      data: {
      },
      headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
    }).then(res => {
      console.log(res)
      this.lists = res.list
    })
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang="scss">
h3 {
  margin: 40px 0 0;
}
ul {
  list-style-type: none;
  padding: 0;
}
li {
  display: inline-block;
  margin: 0 10px;
}
a {
  color: #42b983;
}
</style>
